<%@ page pageEncoding="UTF-8"%>
<%@ include file="../commons/head.jsp"%>
<link rel="stylesheet" href="${ctxStatic}/css/contractEdit/styles.css">
<title>合同编辑</title>
<head>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/load-image.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/canvas-to-blob.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/jquery.blueimp-gallery.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/jquery.fileupload.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/jquery.fileupload-process.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/fileupload/jquery.fileupload-validate.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="${ctxStatic}/js/bootstrap-datetimepicker.zh-CN.js"></script>
<style type="text/css">
</style>
</head>
<body onload="loadMsg(${id})">
	<div class="htedit">
		<div class="container-fluid">
			<h3>合同修改</h3>
			<form id="form" class="form-horizontal"
				action="${ctx}/contract/save1" method="post"  autocomplete="off">
				<input style="display: none;" type="file" id="file" name="imgs">
				<input style="display: none;" id="id" name="id"/><!-- 人的id -->
				<input style="display: none;" id="contractId" name="contractId"/><!-- 合同id -->
				<div class="form-group" style="width: 420px;float: left;">
					<label for="customerPhone" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">手机号码：</label>
					<div class="col-md-2">
						<input id="customerPhone" name="customerPhone"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="customerPhoneErr">
						<label class="error"> </label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="customerName" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">客户姓名：</label>
					<div class="col-md-2">
						<input id="customerName" name="customerName"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="customerNameErr">
						<label class="error"> </label>
					</div>
				</div>
				<div class="form-group">
					<label for="registerAdd" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">户口所在地：</label>
					<div class="col-md-2">
						<input id="registerAdd" name="registerAdd"
							class="form-control isRemove" style="width: 570px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="registerAddErr">
						<label class="error"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="perAdd" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">履约地址：</label>
					<div class="col-md-8">
						<input id="perAdd" name="perAdd"
							class="form-control isRemove" style="width: 570px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-2" id="perAddErr">
						<label class="error">(信函地址)</label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="cardId" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">身份证：</label>
					<div class="col-md-2">
						<input id="cardId" name="cardId"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="cardIdErr">
						<label class="error"> </label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="emerContact" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">紧急联系方式：</label>
					<div class="col-md-2">
						<input id="emerContact" name="emerContact"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="emerContactErr">
						<label class="error"> </label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="origin" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">籍贯：</label>
					<div class="col-md-2">
						<input id="origin" name="origin"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="originErr">
						<label class="error"> </label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="marriage" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">婚姻状况：</label>
					<div class="col-md-2">
						<select id="marriage" name="marriage" class="easyui-combobox" style="width: 180px;height:26px;" required editable="false" panelHeight="auto">
							
							<option value="0">未婚</option>
							<option value="1">已婚</option>
						</select>
					</div>
					<div class="col-md-3" id="marriageErr">
						<label class="error"></label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="sex" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">性别：</label>
					<div class="col-md-2">
						<select id="sex" name="sex" class="easyui-combobox" style="width: 180px;height:26px;" required editable="false" panelHeight="auto">
					
							<option value="0">男</option>
							<option value="1">女</option>
						</select>
					</div>
					<div class="col-md-3" id="sexErr">
						<label class="error"></label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="serFee" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">服务费率：</label>
					<div class="col-md-6">
						<select id="serFee" name="serFee" class="easyui-combobox" style="width: 180px;height:26px;" required editable="false" panelHeight="auto">
							<option value="21">0.21(个人)</option>
							<option value="30">0.30(优惠)</option>
							<option value="38">0.38(基础)</option>
							<option value="50">0.50(上浮)</option>
						</select>
					</div>
					<div class="col-md-2" id="serFeeErr">
						<label class="error">%</label>
					</div>
				</div>
				<div class="form-group">
					<label for="usageq" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">用途：</label>
					<div class="col-md-2">
						<input id="usageq" name="usageq"
							class="form-control isRemove" style="width: 570px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="usageErr">
						<label class="error"></label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="expAmount" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">*拟借款金额：</label>
					<div class="col-md-2">
						<input id="expAmount" name="expAmount"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="expAmountErr">
						<label class="error"> </label>
					</div>
				</div>
				<div class="form-group" style="width: 420px;float: left;">
					<label for="expCyc" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">*拟借款期数：</label>
					<div class="col-md-2">
						<input id="expCyc" name="expCyc"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11"  required/>
					</div>
					<div class="col-md-3" id="expCycErr">
						<label class="error"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="expDate" class="col-md-3 control-label" style="width:100px;margin-left: 20px;">*拟借款日期：</label>
					<div class="col-md-2">
						<input id="expDate" name="expDate"
							class="form-control isRemove" style="width: 180px;height:26px;" type="text"
							value="" maxlength="11" onchange="removeDate()" required readonly/>
					</div>
					<div class="col-md-3" id="expDateErr">
						<label class="error"></label>
					</div>
				</div>
				<div class="form-group">
					<label for="idCardBtn" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;">*身份证：</label>
					<div class="col-md-8">
						<input id="idCardBtn" type="button" value="选择文件" onclick="imgOne()" class="text_sketch">
						<span id="idCardSpan"></span>
						<input id="photoOfIdCard" name="photoOfIdCard" type="hidden" value="">
						<input type='hidden' id='fileId' name='fileId'/>
					</div>
					<div class="col-md-2"></div>
				</div>
				<div class="form-group" id="lvyueDiv" class="lvyueDivClazz">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;">*履约合同：</label>
					<%-- <div class="lvyueMinusDiv">
						<div class="col-md-2">
							<input id="lvyueContractBtn1" type="button" value="选择文件" onclick="imgTwo(1)" class="text_sketch">
							<input id="lvyueContract1" name="lvyueContract"
								type="hidden" value="">
						</div>
						<div class="col-md-2">
							<span style="font-family:'Applied Font Regular', 'Applied Font';">附件</span>
							<span class="minusSpn" style="font-family:'Applied Font Regular', 'Applied Font';">1</span>
						</div>
						<div class="col-md-6">
							<img id="u58_img" class="lvyueMinusBtn" src="${ctxStatic}/images/contract/u58.png">
						</div>
					</div> --%>
				</div>
				<%-- <div class="form-group">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;"></label>
					<div class="lvyueMinusDiv">
						<div class="col-md-2">
							<input id="lvyueContractBtn2" type="button" value="选择文件" onclick="imgTwo(2)" class="text_sketch">
							<input id="lvyueContract2" name="lvyueContract"
								type="hidden" value="">
						</div>
						<div class="col-md-2">
							<span style="font-family:'Applied Font Regular', 'Applied Font';">附件</span>
							<span class="minusSpn" style="font-family:'Applied Font Regular', 'Applied Font';">2</span>
						</div>
						<div class="col-md-6"><img id="u58_img" class="lvyueMinusBtn" src="${ctxStatic}/images/contract/u58.png"></div>
					</div>
				</div> --%>
				<div id="lvyueDivAdd" class="lvyueDivClazz">
				
				</div>
				<div class="form-group" id="lvyueAdd">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;"></label>
					<div class="col-md-6">
						<img id="lvyueAddBtn" class="img" style="width:15px;height:15px;" src="${ctxStatic}/images/contract/u56.png">
					</div>
				</div>
				
				<div class="form-group" id="qitaDiv" class="qitaDivClazz">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;">其他附件：</label>
					<%-- <div class="qitaMinusDiv">
						<div class="col-md-2">
							<input id="qitaContractBtn1" type="button" value="选择文件" onclick="imgThree(1)" class="text_sketch">
							<input id="qitaContract1" name="qitaContract"
								type="hidden" value="">
						</div>
						<div class="col-md-2">
							<input type="text" class="form-control isRemove" style="height:26px;"/>
						</div>
						<div class="col-md-6"><img id="u58_img" class="qitaMinusBtn" src="${ctxStatic}/images/contract/u58.png"></div>
					</div> --%>
				</div>
				<%-- <div class="form-group">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;"></label>
					<div class="lvyueMinusDiv">
						<div class="col-md-2">
							<input id="qitaContractBtn2" type="button" value="选择文件" onclick="imgThree(2)" class="text_sketch">
							<input id="qitaContract2" name="qitaContract"
								type="hidden" value="">
						</div>
						<div class="col-md-2">
							<input type="text" class="form-control isRemove" style="height:26px;"/>
						</div>
						<div class="col-md-6"><img id="u58_img" class="qitaMinusBtn" src="${ctxStatic}/images/contract/u58.png"></div>
					</div>
				</div> --%>
				<div id="qitaDivAdd" class="qitaDivClazz">
				
				</div>
				<div class="form-group">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;"></label>
					<div class="col-md-6">
						<img id="qitaAddBtn" class="img" style="width:15px;height:15px;" src="${ctxStatic}/images/contract/u56.png">
					</div>
				</div>
				<div class="form-group">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;">合同备注:</label>
					<div class="col-md-6">
						<textarea id="memo" name="memo" class="easyui-validatebox form-control easyui-textarea" rows=5 style="width:570px"></textarea>
					</div>
				</div>
				<!-- <div class="form-group">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;">一审拒绝理由:</label>
					<div class="col-md-6">
						<textarea id="firInsReason" name="firInsReason" class="easyui-validatebox form-control easyui-textarea" rows=5 style="width:570px"></textarea>
					</div>
				</div>
				<div class="form-group">
					<label for="" class="col-md-3 control-label"
						style="width:100px;margin-left: 20px;">二审拒绝理由:</label>
					<div class="col-md-6">
						<textarea id="secInsReason" name="secInsReason" class="easyui-validatebox form-control easyui-textarea" rows=5 style="width:570px"></textarea>
					</div>
				</div> -->
				<input style="display: none;" id="status" name="status" value="0"/>
				<!-- 保存按钮 -->
				<hr style="width: 98%;">
				<div class="form-group">
					<div class="col-md-3"></div>
					<a href="#" class="easyui-linkbutton button" iconcls="icon-ok"
						onclick="javascript:save(50)" id="">保存</a>
					<a href="#" class="easyui-linkbutton button" iconcls="icon-ok"
						onclick="javascript:save(40)" id="">提交</a>
					<a href="#" class="easyui-linkbutton button" iconcls="icon-ok"
						 id="">取消</a>
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript">
	var xmluse;
	var mess;
	$(function(){
		$("#expDate").datetimepicker({
			format: 'yyyy-mm-dd',
			autoclose: true,
			language: "zh-CN",
			minView : 2,
		});
		/* $('#expDate').datetimepicker().on('changeDate', function(ev){
			alert(ev);
		    if (ev!=null){
		       $("#expDate").empty();
		    }
		}); */
		/* 附件的"删除"按钮 */
		$('.lvyueMinusBtn').click(function(){
			if($(this).parents("#lvyueDiv").length==1){
				$(this).parents(".lvyueMinusDiv").remove();
			}else{
				$(this).parents(".form-group").remove();
			}
		});
		/* 附件的"添加"按钮 */
		var fjNo = 100;//附件的名字
		//var no = 3;点击选取文件的
		var jj = 0;
		$('#lvyueAddBtn').click(function(){
			fjNo++;
			var str = "<div class='lvyueMinusDiv'>"
					+	"<div class='col-md-2'>"
							+"<input id='lvyueContractBtn"+fjNo+"' type='button' value='选择文件' onclick='imgTwo("+fjNo+")' class='text_sketch'>"
							+"<input id='lvyueContract"+fjNo+"' name='lvyueContract' type='hidden' value=''/>"
						+"</div>"
						+"<div class='col-md-2'>"
							+"<span style='font-family:'Applied Font Regular', 'Applied Font';'>附件</span>"
							+"<span style='font-family:'Applied Font Regular', 'Applied Font';'></span>"
							+"<input style='display: none;' id='minusSpn"+(fjNo)+"' name='minusSpn' value='"+(fjNo)+"'/>"
						+"</div>"
						+"<div class='col-md-6'>"
							+"<img id='u58_img' onclick='lvyueMinusBtn(this)' src='${ctxStatic}/images/contract/u58.png'>"
						+"</div>"
					+"</div>";

			if($('#lvyueDiv').find(".lvyueMinusDiv").length==0){
				$('#lvyueDiv').append(str);
			}else{
				$('#lvyueDivAdd').append("<div class='form-group'>"
						+"<label for='' class='col-md-3 control-label' style='width:100px;margin-left: 20px;'></label>"
						+str+"</div>");
			}
		});
		
		/* 其他附件的"删除"按钮 */
		$('.qitaMinusBtn').click(function(){
			console.log($(this).parents("#qitaDiv"));
			if($(this).parents("#qitaDiv").length==1){
				$(this).parents(".qitaMinusDiv").remove();
			}else{
				$(this).parents(".form-group").remove();
			}
		});
		/* 其他附件的"添加"按钮 */
		var qtNo = 200;//附件的名字
		$('#qitaAddBtn').click(function(){
			qtNo++;
			var str = "<div class='qitaMinusDiv'>"
					+	"<div class='col-md-2'>"
							+"<input id='qitaContractBtn"+qtNo+"' type='button' value='选择文件' onclick='imgThree("+qtNo+")' class='text_sketch'>"
							+"<input id='qitaContract"+qtNo+"' name='qitaContract' type='hidden' value=''/>"
							
						+"</div>"
						+"<div class='col-md-2'>"
						+"<input type='text' id='qtfjName"+qtNo+"' name='qtfjName' class='form-control isRemove' style='height:26px;'/>"
						+"</div>"
						+"<div class='col-md-6'>"
							+"<img id='u58_img' onclick='qitaMinusBtn(this)' src='${ctxStatic}/images/contract/u58.png'>"
						+"</div>"
					+"</div>";

			if($('#qitaDiv').find(".qitaMinusDiv").length==0){
				$('#qitaDiv').append(str);
			}else{
				$('#qitaDivAdd').append("<div class='form-group'>"
						+"<label for='' class='col-md-3 control-label' style='width:100px;margin-left: 20px;'></label>"
						+str+"</div>");
			}
		});
		
		$('#sex').combobox({
			onLoadSuccess : function() {
				var data = $('#sex').combobox('getData');
				if (data) {
					$("#sex").combobox('select', data[0].id);
				}
			}
		});
	});
	
	var idSuccessFlag=0;
	var isFjFlag = false;
	var qtFjFlag = false;
	var p1=0;
	var p2=0;
	var p3=0;
	$("#file").fileupload({
		iframe:true,
		url:'${ctx}/fileUpload/picture',
		maxFileSize:2097152, //(最大2M)字节
		acceptFileTypes:/(\.|\/)('|png|jpeg|jpg')$/i,
		maxNumberofFiles:1,
	}).on('fileuploadprocessalways',function (e,data){
		if (data.files.error) {
			if ('File is too large' == data.files[0].error) {
			alert("照片大小不能超过2M");
			}else if('File type not allowed' == data.files[0].error){
				alert("上传的图片格式必须为jpg/jpeg/png");
			}					
		}else{
			data.submit();	
		}	
		}).on('fileuploaddone',function(e,data){
			if (p1==1) {
				$("#idCardSpan").text(data.result.path.substring(9));
				$("#photoOfIdCard").val(data.result.path);
				p1=0;
			}
			if (isFjFlag){debugger
				$("#lvyueContract"+p2).val(data.result.path);
				isFjFlag = false;
			}
			if (qtFjFlag){debugger
				$("#qitaContract"+p3).val(data.result.path);
				qtFjFlag = false;
			}
	});
	
	function imgOne(){
		p1=1;
		$("#file").click();
	}
	
	function imgTwo(no){
		isFjFlag = true;
		p2=no;
		$("#file").click();
	}
	
	function imgThree(no){
		qtFjFlag = true;
		p3=no;
		$("#file").click();
	}
	
	function lvyueMinusBtn(th){
		console.log("-----------------");
		console.log($(th).parents("#lvyueDiv"));
		if($(th).parents("#lvyueDiv").length==1){
			$(th).parents(".lvyueMinusDiv").remove();
		}else{
			$(th).parents(".form-group").remove();
		}
	}
	function qitaMinusBtn(th){
		if($(th).parents("#qitaDiv").length==1){
			$(th).parents(".qitaMinusDiv").remove();
		}else{
			$(th).parents(".form-group").remove();
		}
	}
	
	function save(){
		var flag = true;
		//手机号验证
		var rephone =/^1[0-9]{10}$/;
		var reg = new RegExp(rephone);
		//不符合手机号规则的,都
		if (!(reg.test($("#cellphone").val()))){
			flag=false;
			$("#cellPhone").html("<div class='error' style='color:red;'>手机号格式错误</div>");
			return true;
	    }
		if (!(reg.test($("#cellphoneForBankCard").val()))){
			flag=false;
			$("#phoneBank").html("<div class='error' style='color:red;'>手机号格式错误</div>");
			return true;
	    }
		if (!(reg.test($("#logisticsPhone").val()))){
			flag=false;
			
			$("#phoneSend").html("<div class='error' style='color:red;'>手机号格式错误</div>");
			return true;
	    }
	}
	//页面加载事件
	function loadMsg(id){debugger
		$.ajax({
			url:'${ctx}/contract/get',
			data:{'id':id},
			async:true,
			success:function(data){debugger
				var flag = true;//填充上面数据
				var flag1  = true;//填充履约合同
				var flag2  = true;//填充其他附件
				
				var j = 1;//其他附件
				/* var ii = 0; *///所有文件
				$.each(data,function(index,value){
					/* ii++; */
					if(flag){
						$("#id").val(data[0].id);
						$("#customerId").val(data[0].customerId);
						$("#contractId").val(data[0].contractId);
						$("#customerPhone").val(data[0].customerPhone);
						$("#customerName").val(data[0].customerName);
						$("#registerAdd").val(data[0].registerAdd);
						$("#perAdd").val(data[0].perAdd);
						$("#cardId").val(data[0].cardId);
						$("#emerContact").val(data[0].emerContact);
						$("#origin").val(data[0].emerContact);
						console.log(data[0].marriage == 0);
						$("#marriage").combobox('setValue', data[0].marriage);
						$("#sex").combobox('setValue',data[0].sex);
						$("#serFee").combobox('select', data[0].serFee);
						
						$("#usageq").val(data[0].usageq);
						$("#expAmount").val(data[0].expAmount);
						$("#expCyc").val(data[0].expCyc);
						$("#expDate").val(data[0].expDate);
						$("#status").val(data[0].status);
						$("#memo").val(data[0].memo);
						$("#firInsReason").val(data[0].firInsReason);
						$("#secInsReason").val(data[0].secInsReason);
						flag = false;
					}
					//下面设置图片
					//身份证
					if(data[index].fileType == "1"){
						$("#idCardSpan").text(data[index].fileAdd.substring(8));
						$("#photoOfIdCard").val(data[index].fileAdd);
						$("#fileId").val(data[index].customerId);
					}
					debugger
					//履约
					if(data[index].fileType == "2"){
						var i = data[index].attachName.substring(2);//这里截取不知道对不对i
						console.log("--"+i);
						var str = "<div class='lvyueMinusDiv'>"
							+	"<div class='col-md-2'>"
									+"<input id='lvyueContractBtn"+i+"' type='button' value='选择文件' onclick='imgTwo("+i+")' class='text_sketch'>"
									+"<input id='lvyueContract"+i+"' name='lvyueContract' type='hidden' value=''/>"
								+"</div>"
								+"<div class='col-md-2'>"
									+"<span style='font-family:'Applied Font Regular', 'Applied Font';'>附件</span>"
									+"<span class='minusSpn' style='font-family:'Applied Font Regular', 'Applied Font';'>"+i+"</span>"
									+"<input style='display: none;' id='minusSpn"+i+"' name='minusSpn' value='"+i+"'/>"
								+"</div>"
								+"<div class='col-md-6'>"
									+"<img id='u58_img' onclick='lvyueMinusBtn(this)' src='${ctxStatic}/images/contract/u58.png'>"
								+"</div>"
							+"</div>";
						if(flag1){//第一次加载到跟"标题同行"
							$('#lvyueDiv').append(str);
							//填充数据
							$("#lvyueContract"+i).val(data[index].fileAdd);//文件名
							/* $("#fileId"+ii).val(data[index].customerId); */
							flag1 = false;
						}else{
							$('#lvyueDivAdd').append("<div class='form-group'>"
									+"<label for='' class='col-md-3 control-label' style='width:100px;margin-left: 20px;'></label>"
									+str+"</div>");
							//填充数据
							$("#lvyueContract"+i).val(data[index].fileAdd);//文件名
							/* $("#fileId"+ii).val(data[index].customerId); */
						}
					}
					debugger
					//其他
					if(data[index].fileType == "9"){
						console.log("##"+j);
						var str = "<div class='qitaMinusDiv'>"
								+"<div class='col-md-2'>"
									+"<input id='qitaContractBtn"+j+"' type='button' value='选择文件' onclick='imgThree("+j+")' class='text_sketch'>"
									+"<input id='qitaContract"+j+"' name='qitaContract' type='hidden' value=''/>"
									
								+"</div>"
								+"<div class='col-md-2'>"
								+"<input type='text' id='qtfjName"+j+"' name='qtfjName' class='form-control isRemove' style='height:26px;'/>"
								+"</div>"
								+"<div class='col-md-6'>"
									+"<img id='u58_img' onclick='qitaMinusBtn(this)' src='${ctxStatic}/images/contract/u58.png'>"
								+"</div>"
							+"</div>";
						
						if(flag2){//第一次加载到跟"标题同行"
							$('#qitaDiv').append(str);
							//填充数据
							$("#qitaContract"+j).val(data[index].fileAdd);//文件名
							$("#qtfjName"+j).val(data[index].attachName);
							flag2 = false;
						}else{
							$('#qitaDivAdd').append("<div class='form-group'>"
									+"<label for='' class='col-md-3 control-label' style='width:100px;margin-left: 20px;'></label>"
									+str+"</div>");
							//填充数据
							$("#qitaContract"+j).val(data[index].fileAdd);//文件名
							$("#qtfjName"+j).val(data[index].attachName);
							/* $("#fileId"+ii).val(data[index].customerId); */
						}
						j++;
					}
				});
			}
		});	
	}
	function save(status){
		$("#status").val(status);//如果点击的是保存,stat为0,点击提交stat为1
		var idSuccessFlag = true;
		var flag = true;
		//手机号验证
		var rephone =/^1[0-9]{10}$/;
		var reg = new RegExp(rephone);
		//手机号码验证
		if (!(reg.test($("#customerPhone").val()))){
			flag=false;
			$("#customerPhoneErr").html("<div class='error' style='color:red;'>手机号格式错误</div>");
			return true;
	    }
		//身份证号验证
		var reIdcard =/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[A-Z])$/;
		var reg = new RegExp(reIdcard);
		if (!(reg.test($("#cardId").val()))){
			flag=false;
			$("#cardIdErr").html("<div class='error' style='color:red;'>身份证号格式错误</div>");
	    }
		
		if (idSuccessFlag&&flag) {
			$("#form").submit();
		}
	}
	</script>
</body>
</html>